/*
* GPLv3
*/
package Bricklink.org.kleini.bricklink.data;
import java.math.BigDecimal;
import java.util.Date;
import org.codehaus.jackson.annotate.JsonProperty;
/**
* {@link PriceDetailDT}
*
* @author <a href="mailto:himself@kleini.org">Marcus Klein</a>
*/
public final class PriceDetailDT {
/**
* The number of the items in the inventory
*/
private int quantity;
/**
* The original price of this item per sale unit
*/
private BigDecimal price;
/**
* Indicates whether or not the seller ships to your country(based on the user profile)
*/
private boolean shippingAvailable;
/**
* The country code of the seller's location
*/
private CountryT sellerCountry;
/**
* The country code of the buyer's location
*/
private CountryT buyerCountry;
/**
* The time the order was created
*/
private Date ordered;
public PriceDetailDT() {
super();
}
@JsonProperty("qunatity")
public int getQunatity() {
return quantity;
}
@JsonProperty("qunatity")
public void setQunatity(int quantity) {
// this.quantity = quantity;
}
@JsonProperty("quantity")
public int getQuantity() {
return quantity;
}
@JsonProperty("quantity")
public void setQuantity(int quantity) {
this.quantity = quantity;
}
@JsonProperty("unit_price")
public BigDecimal getPrice() {
return price;
}
@JsonProperty("unit_price")
public void setPrice(BigDecimal price) {
this.price = price;
}
@JsonProperty("shipping_available")
public boolean getShippingAvailable() {
return shippingAvailable;
}
@JsonProperty("shipping_available")
public void setShippingAvailable(boolean shippingAvailable) {
this.shippingAvailable = shippingAvailable;
}
@JsonProperty("seller_country_code")
public CountryT getSellerCountry() {
return sellerCountry;
}
@JsonProperty("seller_country_code")
public void setSellerCountry(CountryT sellerCountry) {
this.sellerCountry = sellerCountry;
}
@JsonProperty("buyer_country_code")
public CountryT getBuyerCountry() {
return buyerCountry;
}
@JsonProperty("buyer_country_code")
public void setBuyerCountry(CountryT buyerCountry) {
this.buyerCountry = buyerCountry;
}
@JsonProperty("date_ordered")
public Date getOrdered() {
return ordered;
}
@JsonProperty("date_ordered")
public void setOrdered(Date ordered) {
this.ordered = ordered;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((buyerCountry == null) ? 0 : buyerCountry.hashCode());
result = prime * result + ((ordered == null) ? 0 : ordered.hashCode());
result = prime * result + ((price == null) ? 0 : price.hashCode());
result = prime * result + quantity;
result = prime * result
+ ((sellerCountry == null) ? 0 : sellerCountry.hashCode());
result = prime * result + (shippingAvailable ? 1231 : 1237);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PriceDetailDT other = (PriceDetailDT) obj;
// if (buyerCountry != other.buyerCountry)
// return false;
// if (ordered == null) {
// if (other.ordered != null)
// return false;
// } else if (!ordered.equals(other.ordered))
// return false;
if (price == null) {
if (other.price != null)
return false;
} else if (0 != price.compareTo(other.price))
return false;
if (quantity != other.quantity)
return false;
// if (sellerCountry != other.sellerCountry)
// return false;
// if (shippingAvailable != other.shippingAvailable)
// return false;
return true;
}
}